/**
 Copyright will be fixed soon.
 Author: Hiroshi Ota.
 $Date: $
 $Revision: $
*/

#ifndef _PW_MESSAGE_H_
#define _PW_MESSAGE_H_

#ifndef _BRICKOS_
#include "ISimulatorControl.h"
#endif

class Message
{
public:
	static Message* create();
#ifndef _BRICKOS_
	static Message* create(ISimulatorControl* sc);
#endif

	// send a standard firmware message
	void send(unsigned char msg);
	// read received message from standard firmware
	unsigned char receive(bool blockUntil=false);
	// clear last message from standard firmware
	void clear();

	typedef unsigned long (*wakeup)(void*);
	unsigned long taskStart(wakeup);


protected:
	Message(void);
	~Message(void);
#ifndef _BRICKOS_
	Message(ISimulatorControl* sc);

	ISimulatorControl* simCon;
#endif

	static Message* instance;
};

#endif // _PW_MESSAGE_H_
